
import math

def is_prime(n):
    if n < 2:
        return False
    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i == 0:
            return False
    return True

word_to_digit = {
    'zero': '0',
    'one': '1',
    'two': '2',
    'three': '3',
    'four': '4',
    'five': '5',
    'six': '6',
    'seven': '7',
    'eight': '8',
    'nine': '9'
}

words = input().split()

if len(words) != 3:
    print("Wrong input")
else:
    number_str = ''.join([word_to_digit.get(word, '') for word in words])
    
    if number_str.isdigit() and len(number_str) == 3:
        number = int(number_str)
        
        while True:
            if is_prime(number):
                print(number)
                break
            number += 1
    else:
        print("Wrong input")
